package com.fp.m7.shared.dto;

import java.io.Serializable;

/**
 * Base DTO with an ID and overriden equals().
 * 
 * @author 7
 */
public abstract class BaseDto implements Serializable {
    private static final long serialVersionUID = 8537538295309298939L;

    protected Serializable id;

    public BaseDto() {
    }

    public Serializable getId() {
        return id;
    }

    public void setId(Serializable id) {
        this.id = id;
    }

    @Override
    public boolean equals(Object obj) {
        if (obj == null) {
            return false;
        }
        if (obj instanceof BaseDto) {
            BaseDto that = (BaseDto) obj;
            return this.id != null && this.id.equals(that.id);
        }
        return false;
    }

    @Override
    public String toString() {
        return "BaseDto [id=" + id + "]";
    }
}
